package com.evenmo.controller;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.evenmo.pojo.User;
import com.evenmo.pojo.User2;
import com.evenmo.pojo.User3;

@Controller
public class UserController {
	Logger logger= LoggerFactory.getLogger(UserController.class);
@RequestMapping(value="/regist",method=RequestMethod.POST)
	public String registerForm(User user) {
	logger.info("user是："+user);
	logger.info("age2="+user.getAge2());
		return "index";
	}

@RequestMapping(value="/regist2",method=RequestMethod.POST)
public String registerForm2(User2 user2) {
logger.info("user2是："+user2);
logger.info("birthday="+user2.getBirthday());
	return "index";
}

@RequestMapping(value="/login",method=RequestMethod.POST)
public String login(@Valid User3 user3,Errors errors) {
logger.info("user3是："+user3);
logger.info("birthday="+user3.getBirthday());
if(errors.hasErrors()) {
	return "vialidator";
}
	return "success";
}

}
